package com.spring.controller;

import com.spring.dao.OrderDao;
import com.spring.dao.UserDao;
import com.spring.factory.UserDaoFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author:CoolTiger
 * @description: TODO
 * @date:2024/04/24/23:29:45
 **/
public class AppUserFactory {
    public static void main(String[] args) {
        //非spring实例化工厂创建对象
        //UserDaoFactory userDaoFactory = new UserDaoFactory();
        //UserDao userDao = userDaoFactory.getOrderDao();
        //userDao.save();

        //spring实例化工厂创建对象
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        UserDao userDao = (UserDao) ctx.getBean("userDao");
        userDao.save();
    }
}
